<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
	<title>成绩管理</title>
</head>
<body bgcolor="D9DFAA">
<s:set name="Product" value="#request.Product"/>
<s:form name="frm" method="post" enctype="multipart/form-data">
	<table>
		<tr>
			<td>
				供应商名:
				<!-- 以下JS代码是为了保证在页面刷新后，下拉列表中仍然保持着之前的选中项 -->
				<script type="text/javascript">
				function setCookie(name, value) {
					var exp = new Date();
					exp.setTime(exp.getTime() + 24 * 60 * 60 * 1000);
					document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
				}
				function getCookie(name) {
					var regExp = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
					var arr = document.cookie.match(regExp);
					if(arr == null) {
						return null;
					}
					return unescape(arr[2]);
				}
				</script>
				<select name="Supply.supplier_name" id="select_1" onclick="setCookie('select_1',this.selectedIndex)">
					<option selected="selected">请选择</option>
					<s:iterator id="Supply" value="#request.supplyList">
						<option value="<s:property value="#Supply.supplier_name"/>">
							<s:property value="#Supply.supplier_name"/>
						</option>
					</s:iterator>
				</select>
				<script type="text/javascript">
					var selectedIndex = getCookie("select_1");
					if(selectedIndex != null) {
						document.getElementById("select_1").selectedIndex = selectedIndex;
					}
				</script>
				<input name="btn1" type="button" value="查询" onclick="que()">								
			</td>
		</tr>
		<tr>
			<td>
				产品名：
				<input id="thing" type="text" size="19" name="thing" value="<s:property value="#Supplier.thing"/>"/>
				
			</td>
		</tr>
		<tr>
			<td>
				可供应数量：
				<input id="sum" type="text" name="sum" size="19" value="<s:property value="#Supply.sum"/>">
				&nbsp;<input name="btn2" type="button" value="录入" onclick="add()">
				<input name="btn3" type="button" value="删除" onclick="del()">
			</td>
		</tr>
		<tr>
			<td align="left" width="400">
				<table border=1 cellpadding="0" cellspacing="0" width="310">
					<tr bgcolor=#CCCCC0>
						<td align="center">产品名</td>
						<td align="center">进货数量</td>
					</tr>
					<s:iterator value="#request.gysupplyList" id="supp">
					<tr>
						<td align="center"><s:property value="#supp.name"/>&nbsp;</td>
						<td align="center"><s:property value="#supp.sum"/></td>
					</tr>
					</s:iterator>
				</table>
			</td>
		</tr>
	</table>
	<s:property value="msg"/>
</s:form>
</body>
</html>
<script type="text/javascript">
function que() {
	document.frm.action="queSup.action";
	document.frm.submit();
}
function add() {
	document.frm.action="addSup.action";
	document.frm.submit();
}
function del() {
	document.frm.action="delSup.action";
	document.frm.submit();
}
</script>